package com.wn.service;

import com.wn.service.controller.WorkProduct34;
import com.wn.service.controller.WorkProduct2;
import org.junit.jupiter.api.Test;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.QueueBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Bean;

import java.util.Scanner;

/**
 * @author yellow Docter
 * @date 2022 -08-31
 * @desc
 */
@SpringBootTest
public class RabbitMqTest01 {

    @Autowired
    private WorkProduct34 workProduct;

    @Test
    public void demo01_sendMsg(){

        String msg = "中了5百万";
        workProduct.sendMsg(msg);

    }

    @Autowired
    private WorkProduct2 workProduct2;


    @Test
    public void demo02_workqueue_sendMsg(){

        System.out.println("开始叫兄弟来一起写代码:");

        Scanner scanner = new Scanner(System.in);

        while (scanner.hasNext()){
            System.out.println("请输入:");
            String msg = scanner.nextLine();
            workProduct2.sendMsg(msg);
        }
    }

}
